

var newer = newer || {};
newer.gd = newer.gd || {};

newer.PeopleHelper = {
	gotoPeopleHandler: function(event) {
		var self = event.data.self;
		var newurl = location.pathname;
		var origPtype = newer.gd.pstatus.ptype;
		
		if(origPtype == newer.UriHelper.HOME_TYPE) {
			newurl = "/newer/"+newer.UriHelper.PEOPLE_TYPE+"/" + event.data.pid + "/t/posts/";
		} else {
			if(origPtype != newer.UriHelper.PEOPLE_TYPE) {
				newurl = $.xurls({
						operation: "key", 
						okey: newer.gd.pstatus.ptype, 
						akey: newer.UriHelper.PEOPLE_TYPE,
						url: newurl
				});
			}

			newurl = $.xurls({
					operation: "set", 
					key: newer.UriHelper.PEOPLE_TYPE, 
					url: newurl, 
					value: event.data.pid
			});

			newurl = $.xurls({
					operation: "set", 
					key: "t", 
					url: newurl, 
					value: "posts"
			});
		}
		
		history.pushState({}, "", newurl);
		$.debug(location.pathname);
		
		newer.UriHelper.getGlobals();
		self.prt.trigger(origPtype + " goto people");
	}
	
};
